#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Aug  5 13:05:31 2020

@author: zeng
"""

import os
import shutil

baseDir = '/root/workdir/gitdir/linuxcmd/'

#改变目录
os.chdir("{0}/other/pythonFile/".format(baseDir))

zhList = os.listdir("{0}/other/zh-CN/".format(baseDir))  #将该目录下的的所有文件名称存入列表txtList
zhList.sort()   # 显示当前文件夹下所有文件并进行排序
zhNum = len(zhList)
zhCmd = [i[:-10] for i in zhList]

commandList = os.listdir("{0}/command/".format(baseDir))  #将该目录下的的所有文件名称存入列表txtList
commandList.sort()   # 显示当前文件夹下所有文件并进行排序
commandNum = len(commandList)

commandCmd = []
for i in commandList:
    if '.zh-CN.txt' in i:
        commandCmd.append(i[:-10])
    else:
        commandCmd.append(i[:-4])


for idx,iterm in enumerate(zhCmd):
    if iterm not in commandCmd:
        print(iterm)
        shutil.copy('{0}/other/zh-CN/{1}.zh-CN.txt'.format(baseDir,iterm),'{0}/command/{1}.txt'.format(baseDir,iterm))
        shutil.copy('{0}/other/english-txt/{1}.en.txt'.format(baseDir,iterm),'{0}/other/cmd-en/{1}.en.txt'.format(baseDir,iterm))
        print('移动{0}命令'.format(iterm))